<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>determines whether a file exists in the phar</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.mungserver.html">Phar::mungServer</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.offsetget.html">Phar::offsetGet</a></div>
 <div class="up"><a href="class.phar.html">Phar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="phar.offsetexists" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Phar::offsetExists</h1>
  <p class="verinfo">(PHP &gt;= 5.3.0, PECL phar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Phar::offsetExists</span> &mdash; <span class="dc-title">determines whether a file exists in the phar</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-phar.offsetexists-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>Phar::offsetExists</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$offset</code></span>
   )</div>

  <p class="para rdfs-comment">
   This is an implementation of the <span class="interfacename"><strong class="interfacename">ArrayAccess</strong></span> interface allowing
   direct manipulation of the contents of a Phar archive using
   array access brackets.
  </p>
  <p class="para">
   offsetExists() is called whenever <span class="function"><a href="function.isset.html" class="function">isset()</a></span> is called.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-phar.offsetexists-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">offset</code></em></dt>

     <dd>

      <p class="para">
       The filename (relative path) to look for in a Phar.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-phar.offsetexists-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the file exists within the phar, or <strong><code>FALSE</code></strong> if not.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-phar.offsetexists-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-665">
    <p><strong>Example #1 A <span class="function"><strong>Phar::offsetExists()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Phar</span><span style="color: #007700">(</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/my.phar'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'my.phar'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'firstfile.txt'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'first&nbsp;file'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'secondfile.txt'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'second&nbsp;file'</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;the&nbsp;next&nbsp;set&nbsp;of&nbsp;lines&nbsp;call&nbsp;offsetExists()&nbsp;indirectly<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(isset(</span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'firstfile.txt'</span><span style="color: #007700">]));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(isset(</span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'nothere.txt'</span><span style="color: #007700">]));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
bool(false)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-phar.offsetexists-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="phar.offsetget.html" class="function" rel="rdfs-seeAlso">Phar::offsetGet()</a> - Gets a PharFileInfo object for a specific file</span></li>
    <li class="member"><span class="function"><a href="phar.offsetset.html" class="function" rel="rdfs-seeAlso">Phar::offsetSet()</a> - set the contents of an internal file to those of an external file</span></li>
    <li class="member"><span class="function"><a href="phar.offsetunset.html" class="function" rel="rdfs-seeAlso">Phar::offsetUnset()</a> - remove a file from a phar</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.mungserver.html">Phar::mungServer</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.offsetget.html">Phar::offsetGet</a></div>
 <div class="up"><a href="class.phar.html">Phar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
